/* ----------------------------------------------------------------------------
* File: attach_handler_impl.cpp
*
* Desc: Attach handler implementation for Skype instances
*
* Created: 04/05/2011, by Alexey Korshunov
* ---------------------------------------------------------------------------- */
#include "attach_handler_impl.h"
#include "utils.h"

namespace SkypePlugin
{
	AttachHandlerImpl::AttachHandlerImpl(SERVICE_STATUS_HANDLE Handle)
		: m_Handle(Handle)
		, m_CheckPoint(0) 
	{
	}

	void AttachHandlerImpl::OnAttaching()
	{
#ifdef _DEBUG
		MyOutputDebugString("EventHandler: Attaching process...");
#endif 
		SERVICE_STATUS serviceStatus;
		ZeroMemory(&serviceStatus, sizeof(serviceStatus));

		serviceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
		serviceStatus.dwCurrentState = SERVICE_RUNNING;
		serviceStatus.dwCheckPoint = m_CheckPoint++;

		SetServiceStatus(m_Handle, &serviceStatus);
	}
}

